package com.wind.cloud.demo.feign;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

public class FeignTokenInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate requestTemplate) {
        //((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
        requestTemplate.header("token", "token");
    }
}
